import _ from 'lodash-es';
import { getShapeModel } from '../shapes';
import GraphModel from './GraphModel';

const setupModel = (config) => {
  const graphModel = new GraphModel();

  _.each(config.nodes, node => {
    const Model = getShapeModel(node.type);
    if (Model) {
      graphModel.nodes.push(new Model(node));
    }
  });
  
  return {
    graphModel,
  };
}

export {
  setupModel,
};
